﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using HostpitalDevice.Business;
namespace HostpitalDevice
{
    public partial class CompanyTreeForm : Form
    {
        private int companyid ;
        private String companyName;
        public int getCompanyid()
        {
            return companyid;
        }
        public String getName()
        {
            return companyName;
        }
        public CompanyTreeForm()
        {
            InitializeComponent();
            this.companyid = -1;
            this.companyName = "";
        }

        private void CompanyTreeForm_Load(object sender, EventArgs e)
        {
            CompanyManage.FillCompanyTree(this.tvCompany);
        }

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (companyid != -1 && companyid != 1)
            {
                this.Close();
            }

            else
                MessageBox.Show("请选择单位！");
        }

        private void tvCompany_AfterSelect(object sender, TreeViewEventArgs e)
        {
            this.companyid = int.Parse(e.Node.Tag.ToString());
            this.companyName = e.Node.Text.ToString();

        }

        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }
}